package com.example.car

import androidx.activity.viewModels
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.ToastUtils
import com.example.car.databinding.ActivityPayMentsBinding
import com.example.car.vm.CarViewModel
import com.example.common.view.view.BaseMvvmActivity
import dagger.hilt.android.AndroidEntryPoint
import java.text.SimpleDateFormat

@AndroidEntryPoint
@Route(path = "/car/PayMentsActivity")
class PayMentsActivity : BaseMvvmActivity<ActivityPayMentsBinding>() {
    @Autowired
    @JvmField
    var id:Int = 0
    private val carDetailViewModel:CarViewModel by viewModels()
    override fun initView() {
        ARouter.getInstance().inject(this)
        mDataBinding.tvTime.text = SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis())
        mDataBinding.sysTime.text = SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis())
        carDetailViewModel.getPayCar(id)
    }

    override fun observeDataChange() {
        carDetailViewModel.mGetPayCarSuccess.observe(this){
            mDataBinding.tvCode.text = "车牌号: ${it.plateNumber}"
            ToastUtils.showShort("缴费列表显示成功")
        }
    }
    override fun getLayoutId(): Int = R.layout.activity_pay_ments
}